package com.fire.communication.web.web;

import cn.hutool.json.JSONObject;
import com.fire.communication.common.base.BaseController;
import com.fire.communication.support.annotaion.Action;
import com.fire.communication.support.annotaion.At;
import com.fire.communication.support.model.RespEntity;
import com.fire.communication.web.service.SmsVoiceMarginService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

/**
 * @Author: YangYu
 * @ClassName: SmsVoiceMarginController
 * @Date: Created in 15:28 2023/5/26
 * @Description:
 */
@Action
@RequestMapping(value="smsVoiceMargin")
public class SmsVoiceMarginController extends BaseController {

    @Resource
    private SmsVoiceMarginService smsVoiceMarginService;

    /**
     * @Author YangYu
     * @Description 余量新增、编辑
     * @Date Created in 15:31 2023/5/26
     * @Param [jsonParam]
     */

    @At(value = "addOrUpdate", method = RequestMethod.POST)
    public RespEntity addOrUpdate(@RequestBody(required = false) JSONObject jsonParam) {
        return smsVoiceMarginService.addOrUpdate(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 短信、语音余量列表
     * @Date Created in 15:32 2023/5/26
     * @Param [jsonParam]
     */

    @At(value = "smsVoiceMarginList", method = RequestMethod.GET, param = { "homeId"})
    public RespEntity smsVoiceMarginList(@RequestBody(required = false) JSONObject jsonParam) {
        return smsVoiceMarginService.smsVoiceMarginList(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 批量插入单位短信、语音使用条数
     * @Date Created in 15:31 2023/5/26
     * @Param [jsonParam]
     */

    @At(value = "setBusinessCount", method = RequestMethod.POST)
    public RespEntity setBusinessCount(@RequestBody(required = false) JSONObject jsonParam) {
        return smsVoiceMarginService.setBusinessCount(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 删除之后释放条数
     * @Date Created in 15:31 2023/5/26
     * @Param [jsonParam]
     */

    @At(value = "releaseNumberPieces", method = RequestMethod.POST)
    public RespEntity releaseNumberPieces(@RequestBody(required = false) JSONObject jsonParam) {
        return smsVoiceMarginService.releaseNumberPieces(jsonParam);
    }

}
